package com.question.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.question.pojo.entity.UserFavorite;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * 用户收藏记录
 */
@Mapper
public interface UserFavoriteMapper extends BaseMapper<UserFavorite> {


    /**
     * 获取用户收藏数量
     *
     * @param userId 用户ID
     * @return 收藏数量
     */
    @Select("SELECT COUNT(*) FROM user_favorites WHERE user_id = #{userId}")
    Integer countUserFavorites(@Param("userId") Long userId);
}
